package com.ituhh;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

import java.util.Calendar;
import java.util.List;

import com.ituhh.utils.Mensa;
import com.ituhh.utils.Wget;


public class iTuHH extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		String tmpstring=Wget.download("http://www.studierendenwerk-hamburg.de/essen/woche.php?haus=Harburg");
	    List<String> meallist=Mensa.format(tmpstring);
		int i,mealkind=0;
		i=Calendar.getInstance().get(Calendar.DAY_OF_WEEK)+3;
		tmpstring=meallist.get(i) + "\n";
		for(i+=8;(i+6)<54;i+=6)
		{
			if(meallist.get(i)!="")tmpstring+=meallist.get(12+mealkind) + " :\n" + meallist.get(i)+ "\n\n";
			mealkind+=6;
		}
		TextView tview=new TextView(this);
		tview.setText(tmpstring);
		tview.setPadding(5,5,5,5);
		tview.setWidth(2);
		setContentView(tview);
	}
}